package com.skin.admin.common;

import com.skin.admin.entity.Fenye;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2018/7/24 0024.
 */
public class FenyeSetting {

    /**
     * 分页设置 可设置类型
     * @param size 每页显示多少条
     * @param request 当前页
     * @return
     */
    public static Fenye setfenye(int size, HttpServletRequest request) {
        Fenye fenye=new Fenye();
        String reqpage =request.getParameter("currentpage");
        if(reqpage!=null && !reqpage.isEmpty()){
            fenye.setCurrent(Integer.parseInt(reqpage));
            fenye.setSize(size);
        }else{
            fenye.setCurrent(1);
            fenye.setSize(1);
        }
        return fenye;
    }
    /**
     * 分页设置 默认显示30条
     * @param request 当前的页面
     * @return
     */
    public static Fenye setfenye(HttpServletRequest request) {
        Fenye fenye=new Fenye();
        String reqpage =request.getParameter("currentpage");
        if(reqpage!=null && !reqpage.isEmpty()){
            fenye.setCurrent(Integer.parseInt(reqpage));
        }else{
            fenye.setCurrent(1);
        }
        fenye.setSize(30);
        return fenye;
    }
}
